<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>条件分支语句switch</title>
</head>

<body>
  <script>
    //准备一个变量。当做已知条件
    var foot = 50
    //使用switch语句进行选择
    switch (foot) {
      default:
        console.log('去别的店看看')
      case 37:
        console.log('买一双37号的鞋')//没有break会从第一个满足条件的位置开始向下穿透 直到break为止
      case 40:
        console.log('买一双40号的鞋')
      case 41:
        console.log('买一双41号的鞋')
      case 42:
        console.log('买一双42号的鞋')
        break
    }


    function convert(x) {
      switch (typeof x) {
        case "number":
          return x.toString(16);
        case "string":
          return '"' + x + '"'
        default:
          return String(x)
      }
    }
    console.log(convert(56565646));
    console.log(typeof convert(56565646));
    console.log(typeof typeof convert(56565646));
  </script>
</body>

</html>